package com.mmt.smartloan.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.mmt.smartloan.R;
import com.mmt.smartloan.util.Utils;

public class PermissionItemView extends RelativeLayout {
    public PermissionItemView(Context context) {
        super(context);
        init(context,null);
    }

    public PermissionItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context,attrs);
    }

    private void init(Context context, AttributeSet attrs) {
        LayoutInflater.from(context).inflate(R.layout.permission_item, this);
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PermissionItemView);
        String titleText = ta.getString(R.styleable.PermissionItemView_title);
        String contentText = ta.getString(R.styleable.PermissionItemView_content_text);
        ta.recycle();
        TextView title = findViewById(R.id.title);
        TextView content = findViewById(R.id.content);
        title.setText(titleText);
        content.setText(contentText);
        setPadding(Utils.dip2px(19),0,Utils.dip2px(24),0);

    }

    public PermissionItemView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context,attrs);
    }

}
